package zz.app.jmhviewer;

import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.RequiresApi;

import zz.app.jmhviewer.JMH.JMHUtils;

/**
 * Created by zz on 2018/1/31 21:47.
 */

public class GetPicDataTask extends AsyncTask<String,Integer,Integer>{
    private Context context;
    private String picData;
    private OnFinishedListener listener;
    public GetPicDataTask(Context c, OnFinishedListener l){
        context=c;
        listener=l;
    }

    public String getPicData() {
        return picData;
    }


    @Override
    protected Integer doInBackground(String... strings) {

        String host = strings[0];
        String name = strings[1];
        String which = strings[2];
        picData = JMHUtils.getPicData(host, name,which,null);
        return 0;
    }



    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onPreExecute() {
        super.onPreExecute();

    }

    @Override
    protected void onPostExecute(Integer o) {
        super.onPostExecute(o);
        if(listener!=null)listener.onFinish();


    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        super.onProgressUpdate(values);

    }
}
